import React from 'react';

import BaseExecuter from '../common/BaseExecuter';
import Constants from '../../common/Constants';

export default class ActivityExecuter extends BaseExecuter {
    execute(action) {
      switch (action.name) {
        case "ActivityRequestListAction":
          this._requesList(action);
          break;
        case "ActivityRequestEntryListAction":
          this._requesEntryList(action);
          break;
        case "ActivityRequestFollowAction":
          this._requestFollow(action);
          break;
        case "ActivityRequestEnterAction":
          this._requestEnter(action);
          break;
        case "ActivityRequestEntryRule":
          this._requestEnterRule(action);
          break;
        case "ActivityRequestEnterAutoAction":
          this._requestEnterAuto(action);
          break;
        case "ActivityRequestContentAction":
          this._requestContent(action);
          break;
        case "ActivityRequestBaomingAction":
          this._requestBaoming(action);
          break;
        case "ActivityRequestApplicantsAction":
          this._requestApplicants(action);
          break;
        case "ActivityRequestOneApplicantAction":
          this._requestOneApplicant(action);
          break;
        case "ActivityLikeSingerAction":
          this._requestLikeSinger(action);
          break;
      }
    }

    _requestLikeSinger(action) {
      this._sendRequestCommonResponse(action, "sendRequestLikeSinger");
    }

    _requestOneApplicant(action) {
      this._sendRequestCommonResponse(action, "sendRequestOneApplicant");
    }

    _requestApplicants(action) {
      this._sendRequestCommonResponse(action, "sendRequestApplicants");
    }

    _requestContent(action) {
      this._sendRequestCommonResponse(action, "sendRequestContent");
    }

    _requestEnter(action) {
      if(action.data.type == "enter") {
        this._sendRequestCommonResponse(action, "sendRequestEnter");
      }
      else if(action.data.type == "cancel"){
        this._sendRequestCommonResponse(action, "sendCancelEnter");
      }
      else {
        console.warn("error type in requestEnter");
      }
    }
    _requestEnterRule(action){
      this._sendRequestCommonResponse(action, "sendRequestEnterRule");
    }

    _requestEnterAuto(action){
      this._sendRequestCommonResponse(action, "sendRequestAuto");
    }

    _requestFollow(action) {
      this._sendRequestCommonResponse(action, "sendRequestFollow");
    }

    _requesList(action) {
      this._sendRequestCommonResponse(action, "sendRequestList");
    }
    _requesEntryList(action) {
      this._sendRequestCommonResponse(action, "sendRequestEntryList");
    }

    //我的报名
    _requestBaoming(action) {
      this._sendRequestCommonResponse(action, "sendRequestBaoming");
    }

    _getModuleType() {
      return Constants.MODULE_TYPE.ACTIVITY;
    }
}
